﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using SimpComm;
using ViewModel;

namespace Bll
{
    public class IndustryService : BaseService<Industry>
    {
        private static readonly IndustryService instance = new IndustryService();

        static IndustryService()
        {
        }

        private IndustryService()
        {
        }

        public static IndustryService Instance
        {
            get { return instance; }
        }

        public DataInfo<Industry> GetDetailModel(int ID)
        {
            return base.GetEntity(p => p.ID == ID);
        }

        public string GetIndustryName(int? industry_type, string industry_cn)
        {
            if (industry_cn.NotN())
                return industry_cn;
            if (industry_type.HasValue && industry_type.Value > 0)
            {
                var data = GetDetailModel(industry_type.Value);
                if (data.Success)
                    return data.Data.Name;
            }
            return "查询不到相关行业";
        }
    }
}
